package com.jcl.recruit.console.user.dao;

import com.jcl.recruit.console.user.mapper.SysUserMapper;
import com.jcl.recruit.console.user.model.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @ClassName UserDao
 * @Author yyliu
 * @Date 2018/12/18 10:51
 * @Version 1.0
 **/
@Component
public class SysUserDao implements SysUserMapper {

    @Autowired
    private SysUserMapper sysUserMapper;

    public UserDetails findUserDetail(String username) {
        return (UserDetails) findOne(username);
    }

    @Override
    public List<SysUser> findList() {
        return sysUserMapper.findList();
    }

    @Override
    public SysUser findOneById(Integer id) {
        return sysUserMapper.findOneById(id);
    }

    @Override
    public SysUser findOne(String username) {
        return sysUserMapper.findOne(username);
    }

    @Override
    public int insert(SysUser entity) {
        return sysUserMapper.insert(entity);
    }

    @Override
    public int update(SysUser entity) {
        return sysUserMapper.update(entity);
    }

    @Override
    public int updatePw(Integer id, String password) {
        return sysUserMapper.updatePw(id, password);
    }

    @Override
    public int delete(Integer id) {
        return sysUserMapper.delete(id);
    }
}
